package com.kenliang.javase.utils;

import java.util.Random;

/**
 * @author KenLiang
 * @description:
 * @date Created in 11:08 AM 2018/12/18.
 */
public class RandomUtils {
    public static final String ALPHABET_SOURCES =
            "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

    public static String generateString(String source, int length) {
        Random random = new Random();
        char[] text = new char[length];
        for (int i = 0; i < length; i++) {
            text[i] = source.charAt(random.nextInt(source.length()));
        }
        return new String(text);
    }

    public static void main(String[] args) {
        System.out.println("before");
        new Thread(()->{
            try {
                Thread.sleep(1000*2);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            for(int i=0;i<10000;i++){
                System.out.println(i);
            }
        }).start();

        System.out.println("after");
    }
}
